This sample code shows the use of Area Object. Modify the following sample code to fit your needs.
Private Sub Command1_Click()
On Error GoTo Command1_Click_Error
Dim crystalApplication As CRPEAuto.Application
Dim crystalReport As CRPEAuto.Report
Dim crystalArea As CRPEAuto.Area
Dim intAreaKind As Integer
Dim strAreaDescription As String
Set crystalApplication = CreateObject("Crystal.CRPE.Application")
Set crystalReport = crystalApplication.OpenReport _
("d:\crw\reports\craze\wwsales.rpt")
Set crystalArea = crystalReport.Areas.Item(1)
intAreaKind = crystalArea.Kind
Select Case intAreaKind
Case 1
strAreaDescription = "ReportHeader"
Case 2
strAreaDescription = "PageHeader"
Case 3
strAreaDescription = "Group Header"
Case 4
strAreaDescription = "Detail"
Case 5
strAreaDescription = "GroupFooter"
Case 7
strAreaDescription = "PageFooter"
Case 8
strAreaDescription = "ReportFooter"
Case Default
strAreaDescription = "Unknown area."
End Select
MsgBox "Crystal Area Kind is <" + strAreaDescription + ">"
Command1_Click_Exit:
Exit Sub
Command1_Click_Error:
If crystalApplication Is Nothing Then
MsgBox "Unable to CreateObject(""Crystal.CRPE.Application"")"
GoTo Command1_Click_Exit
End If
If crystalReport Is Nothing Then
MsgBox "Unable to OpenReport(""d:\crw\reports\craze\wwsales.rpt"")"
GoTo Command1_Click_Exit
End If
MsgBox "Unknown error in Command1_Click routine"
GoTo Command1_Click_Exit
End Sub
Seagate Software IMG Holdings, Inc. http://www.seagatesoftware.com Support services: http://support.seagatesoftware.com |